/**
 * Copyright (c) 2013 Mark Tielemans
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * DISCLAIMER
 * This software is provided "as is" and any expressed or implied warranties, including, but not limited to, the implied warranties of 
 * merchantability and fitness for a particular purpose are disclaimed. In no event shall the regents or contributors be liable for any 
 * direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute 
 * goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in 
 * contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if 
 * advised of the possibility of such damage.
 */
package test.easydb.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import nl.marktielemans.easydb.model.EasyDBEntity;
import nl.marktielemans.easydb.model.TableColumn;

public class Account implements EasyDBEntity {
	
	private String uuid;
	private String username;
	private String email;
	private Date registrationDate;
	private transient String password;

	public Account(String username, String email) {
		this.username = username;
		this.email = email;
		registrationDate = new Date();
	}
	
	public Account(String uuid, String username, String email, Date registrationDate) {
		super();
		this.uuid = uuid;
		this.username = username;
		this.email = email;
		this.registrationDate = registrationDate;
	}

	public Account() {
	}

	public String getUuid() {
		return uuid;
	}
	
	public String getUsername() {
		return username;
	}

	public Date getRegistrationDate() {
		return registrationDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Override
	public List<TableColumn<?>> getProperties() {
		List<TableColumn<?>> columns = new ArrayList<TableColumn<?>>();
		columns.add(new TableColumn<String>("uuid", uuid));
		columns.add(new TableColumn<String>("username", username));
		columns.add(new TableColumn<String>("email", email));
		columns.add(new TableColumn<Date>("registerDate", registrationDate));
		if(password!=null) columns.add(new TableColumn<String>("password", password));
		return columns;
	}
	
	public void setPassword(String pwd) {
		this.password=pwd;
	}
}
